package gwtgaetools.client.ui;

import gwtgaetools.client.ItemManager;
import gwtgaetools.client.ui.SmartInlineLabel;

import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Widget;

public class EditableLabelWithName<M> extends EditableLabel<M> {

	SmartInlineLabel<String> name = new SmartInlineLabel<String>();
	
	FlowPanel fp = new FlowPanel();
	
	public EditableLabelWithName(ItemManager<M> m, String s, ItemManager<String> ms) {
		super(m);
		addTextboxStyle(s);
		ms.registerListener(name);
	}
	
	@Override public Widget getActiveWidget() {
		fp.clear();
		fp.add(name);
		fp.add(super.getActiveWidget());
		return fp;
	}

	@Override public void addTextboxStyle(String s) {
		textbox.addStyleDependentName(s);
		label.addStyleDependentName(s);
		name.addStyleDependentName(s);
	}
	
}
